package com.welsy.user.business
{
	import mx.rpc.Fault;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.soap.mxml.WebService;	
	import mx.rpc.AbstractOperation;	
	import mx.rpc.IResponder;
	import mx.rpc.AsyncToken;
	import com.adobe.cairngorm.business.ServiceLocator;
	
	public class GetUserCreditsDelegate
	{
		public function GetUserCreditsDelegate( responder : IResponder )
		{		
			this.service = ServiceLocator.getInstance().getWebService("UserResultsService") as WebService;
			this.responder = responder;
		}		
		
		public function getCredits(userId : String) : void {
			//Create the request
			var op : AbstractOperation = service.getOperation("GetUserCredits");
			op.arguments.GetUserCreditsRequest.UserId = userId;
			
			var token : AsyncToken = service.GetUserCredits();
			token.addResponder(responder);
			
		}
		
		private var responder : IResponder;
		private var service : Object;
	}

}